package logic

import (
	"github.com/gin-gonic/gin"
	"github.com/vueadmin/app/admin/internal/dto"
	"github.com/vueadmin/app/admin/internal/service"
	"github.com/vueadmin/app/admin/internal/svc"
	"github.com/vueadmin/app/admin/internal/vo"
)

type logLogic struct {
	ctx    *gin.Context
	svcCtx *svc.ServiceContext
}

func NewLogLogic(ctx *gin.Context, svcCtx *svc.ServiceContext) *logLogic {
	return &logLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
	}
}

/**
 * @description(数据列表)
 * @buildcode(true)
*/
func (p logLogic) GetPageList(req *dto.LogPageReq) ([]*vo.LogList, int64, error) {
	s := service.NewLogService(p.svcCtx)
	return s.GetPageList(req)
}

/**
 * @description(删除)
 * @buildcode(true)
*/
func (p logLogic) Delete(req *dto.LogDeleteReq) error {
	s := service.NewLogService(p.svcCtx)
	return s.Delete(req)
}

/**
 * @description(查看详情)
 * @buildcode(true)
*/
func (p logLogic) Detail(req *dto.LogDetailReq) (*vo.LogDetail, error) {
	s := service.NewLogService(p.svcCtx)
	return s.Detail(req)
}

/**
 * @description(导出)
 * @buildcode(true)
*/
func (p logLogic) Export(req *dto.LogPageReq) ([]*vo.LogExport,int64, error) {
	s := service.NewLogService(p.svcCtx)
	return s.Export(req)
}

/**
 * @description(查询sql下拉字段列表)
 * @buildcode(true)
*/
func (p logLogic) GetFieldList(c *gin.Context) (map[string]interface{}, error) {
	s := service.NewLogService(p.svcCtx)
	return s.GetFieldList(p.ctx)
}

